package struts.action;

import javax.naming.InitialContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import struts.actionform.CheckoutForm;

import ejb.bl.CartBeanRemote;
import ejb.bl.MusicStoreBLRemote;

public class CheckoutAction extends Action {

	// Define EJB Session Bean
	private CartBeanRemote CartBean;
	private MusicStoreBLRemote MusicStoreBLBean;

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HttpSession session = request.getSession();
		InitialContext ic=null;
		if(session.getAttribute("sessionContext")==null){
			ic = new InitialContext();
			session.setAttribute("sessionContext",ic);
		}else{
			ic =(InitialContext)session.getAttribute("sessionContext");
		}
		
		CartBean = (CartBeanRemote)session.getAttribute("CartBean");
		String forward2Page = null;
		CheckoutForm objForm = (CheckoutForm)form;

		// Display the registration form to the user
		return mapping.findForward("input");
	}
}
